/**
 * There are code generation
 */
package com.neusoft.lohas.modules.ivm.service.order;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.neusoft.lohas.common.service.BaseService;
import com.neusoft.lohas.modules.ivm.entity.order.ShoppingCart;
import com.neusoft.lohas.modules.shop.dao.ShoppingCartDao;

/**
 * 购物车Service
 * @author Jackie.Liu
 * @version 2014-12-16
 */
@Component
@Transactional(readOnly = true)
public class ShoppingCartService extends BaseService {

	@Autowired
	private ShoppingCartDao shoppingCartDao;
	
	public ShoppingCart get(String id) {
		return shoppingCartDao.get(id);
	}
	
	@Transactional(readOnly = false)
	public void save(ShoppingCart shoppingCart) {
		shoppingCartDao.clear();
		shoppingCartDao.save(shoppingCart);
	}
	
	@Transactional(readOnly = false)
	public void save(List<ShoppingCart> cartList) {
		shoppingCartDao.save(cartList);
	}
	
	@Transactional(readOnly = false)
	public void delete(String id) {
		shoppingCartDao.deleteById(id);
	}

}
